<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->id();
            $table->string('name',20)->comment('评论者名称');
            $table->string('email',25)->comment('评论者的电子邮件地址');
            $table->text('comment')->comment('评论');
            $table->integer('parent_id')->default(0)->comment('上级评论id');
            $table->enum('status',['0','1','2'])->default('0')->comment('状态0未审核,1通过，2删除或失效');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
